package Offer;

public class Test19 
{

	public static void main(String[] args) 
	{

	}
    public static void mirrorTree(BinaryTreeNode root)
    {
    	if(root==null)
    		return ;
    	if(root.left==null&&root.right==null)
    		return;
    	BinaryTreeNode temp =root.left;
    	root.left=root.right;
    	root.right=temp;
    	if(root.left!=null)
    	{
    		mirrorTree(root.left);
    	}
    	if(root.right!=null)
    	{
    		mirrorTree(root.right);
    	}
    	
    	
    }
}

class TreeMirror{
	public static void mirrorOfTree(TreeNode root){
		if(root == null || (root.left == null && root.right == null)){
			return;
		}
		TreeNode left = root.left;
		root.left = root.right;
		root.right = left;
		if(root.left != null){
			mirrorOfTree(root.left);
		}
		if(root.right != null){
			mirrorOfTree(root.right);
		}
	}
}
